package com.dream21th.flow.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class ComResp<T> {

    private T data;

    private String code;

    private String msg;

    public ComResp<T> data(T t){
        this.data=t;
        return this;
    }

    public ComResp<T> success(){
        this.code=Contansts.SUCCESS;
        this.msg=Contansts.SUCCESS_MSG;
        return this;
    }

    public ComResp<T> fail(){
        this.code=Contansts.FAIL;
        this.msg=Contansts.FAIL_MSG;
        return this;
    }

    public ComResp<T> fail(String code,String msg){
        this.code=code;
        this.msg=msg;
        return this;
    }
}
